﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<DAL.Facility>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <script type="text/javascript">
        function CreateNew() {
            document.location.href = "/Facilities/New";
        }
    </script>

    <h2>New Facility</h2>
    <dvi>
        <%if (ViewData["Result"] != null)
          { %>
            <div style="display:block; font-size:1.2em; font-weight:bold; color: Aqua;">
            <%:Html.Label(ViewData["Result"] as string) %>
            </div>
        <%} %>
    </dvi>
    <% using (Html.BeginForm("New", "Facilities", FormMethod.Post, new { enctype = "multipart/form-data" , id="postform", name="postform" }))
        {%>
        <br />
    <div style="display:block;">
        <div style="width:130px; float:left;">Name </div>
        <div><%=Html.TextBoxFor(c=>c.Name) %>
        </div>
    </div>
    
    <div>
        <div style="width:130px; float:left;">Description</div>
         <div style="vertical-align:top;"><%=Html.TextAreaFor(c => c.Description, new { style="width:600px;"})%>
        </div>
    </div>
    <div>
        <div style="width:130px; float:left;">UnderMaintenance</div>
         <div style="width:auto"><%=Html.CheckBoxFor(c=>c.IsUnderMaintenance) %>
        </div>
      
    </div>
    <div>
        <div style="width:130px; float:left;">File</div>
         <div><%=Html.TextBoxFor(c => c.PicUrl)%><input type="file" id="fileUpload" name="fileUpload" size="23"/> 
        </div>             
    </div>
    <%if (Convert.ToString(ViewData.Model.SystemFileName) != null)
      { %>  
        <img src="<%=ViewData.Model.SystemFileName%>" />
    <%} %>                                       
    <div>
        <%if (ViewData["Result"] != null)
          {%>
         <input type="button" value="New" onclick="javascript:CreateNew()" />
         <input type="submit" value="Save" disabled="disabled" />
         <%}
          else
          { %>           
          <input type="submit" value="Save"/>
         <%} %>
    </div>    
     <% } %>    

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
